package com.soup.lab.http.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@ConfigurationProperties(prefix = "http-client-pool")
@Component
public class PoolingHttpClientProperty {

    /**
     * 最大线程数
     */
    private Integer maxTotal = 100;

    /**
     * 默认每个Ip线程数
     */
    private Integer defaultMaxPerRoute = 60;

    /**
     * 连接上服务器(握手成功)的时间
     */
    private Integer connectTimeout = 30_000;

    /**
     * 从连接池中获取连接的超时时间
     */
    private Integer connectionRequestTimeout = 30_000;

    /**
     * 服务器返回数据(response)的时间
     */
    private Integer socketTimeout = 60_000;

    /**
     * 用于校验线程空闲的时间
     */
    private Integer validateAfterInactivity = 2_000;


    public Integer getMaxTotal() {
        return maxTotal;
    }

    public void setMaxTotal(Integer maxTotal) {
        this.maxTotal = maxTotal;
    }

    public Integer getDefaultMaxPerRoute() {
        return defaultMaxPerRoute;
    }

    public void setDefaultMaxPerRoute(Integer defaultMaxPerRoute) {
        this.defaultMaxPerRoute = defaultMaxPerRoute;
    }

    public Integer getConnectTimeout() {
        return connectTimeout;
    }

    public void setConnectTimeout(Integer connectTimeout) {
        this.connectTimeout = connectTimeout;
    }

    public Integer getConnectionRequestTimeout() {
        return connectionRequestTimeout;
    }

    public void setConnectionRequestTimeout(Integer connectionRequestTimeout) {
        this.connectionRequestTimeout = connectionRequestTimeout;
    }

    public Integer getSocketTimeout() {
        return socketTimeout;
    }

    public void setSocketTimeout(Integer socketTimeout) {
        this.socketTimeout = socketTimeout;
    }

    public Integer getValidateAfterInactivity() {
        return validateAfterInactivity;
    }

    public void setValidateAfterInactivity(Integer validateAfterInactivity) {
        this.validateAfterInactivity = validateAfterInactivity;
    }
}
